﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Tec2.GUI.Base;

namespace Tec2.GUI.Dialog {
    public partial class Reparatur : TpBase {

        #region Members

        bool reparatur;

        #endregion

        #region Constructor

        public Reparatur() {
            InitializeComponent();
            SetData();
        }

        public Reparatur(byte defaultButton)
            : this() {
                this.rbReparatur.Checked = true;
                if (defaultButton == 2) {
                    this.rbProjekt.Checked = true;
                }
        }

        public Reparatur(string auswahlText, string text1, string text2) :this() {
            SetText(auswahlText, text1, text2);
        }

        #endregion

        #region Properties

        public bool IsReparatur {
            get { return this.reparatur; }
            set { this.reparatur = value; }
        }

        public bool Cancel {
            get;
            set;
        }

        #endregion

        #region Methods

        private void SetData() {
            Cancel = true;
            IsReparatur = true;
            this.rbReparatur.Checked = true;
        }

        private void SetDataBeforeClose() {
            IsReparatur = this.rbReparatur.Checked;
            Cancel = false;
        }

        private void SetText(string auswahl, string text1, string text2) {
            this.gbAuswahl.Text = auswahl;
            this.rbReparatur.Text = text1;
            this.rbProjekt.Text = text2;
        }

        #endregion

        #region Events

        private void btnOk_Click(object sender, EventArgs e) {
            SetDataBeforeClose();
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e) {
            this.Close();
        }

        #endregion

    }
}
